package cn.zcx;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * description:
 * author:zcx
 * lenovo
 * 时间：2022.02.11.15.26
 */
public class AdBook {
    static List<Object> list=new ArrayList<>();

    public static void main(String[] args) {
        var bk=new Book();
        var bk1=new Book();
        var bk2=new Book();
        var bk3=new Book();
        var bk4=new Book();
        var bk5=new Book();
        var bk6=new Book();
        var bk7=new Book();
        var bk8=new Book();
        var bk9=new Book();
      bk.setBookname("Java基础");
      bk.setAutor("zcx");
      bk.setPrice(32);
      addbooks(bk);
        bk1.setBookname("Php基础");
        bk1.setAutor("zcxe");
        bk1.setPrice(38);
        addbooks(bk1);
        bk1.setBookname("Mysql基础");
        bk1.setAutor("zcxe");
        bk1.setPrice(66);
        addbooks(bk2);
        bk1.setBookname("Hadoop基础");
        bk1.setAutor("zcxe");
        bk1.setPrice(88);
        addbooks(bk3);

        boolean f=true;
        while (f) {
            System.out.println("请输入查询书名");
            Scanner sc = new Scanner(System.in);
            String l = sc.nextLine();
            for (Object m : list) {
                if (m.equals(l)) {
                    System.out.println(m.toString());
                    f=false;
                }
            }
            if(f){
                System.out.println("没有该书籍");
                f=true;}

        }

    }
    static void addbooks(Object obj){
        list.add( obj);
    }
}
